package com.domi.controller;

import com.domi.config.RedisConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class InfoController {

    @Value("${mysql.username:}")
    private String mysqlUsername;
    @Value("${mysql.password:}")
    private String mysqlPassword;

    @Value("${basic.username:}")
    private String basicUsername;
    @Value("${basic.password:}")
    private String basicPassword;

    @Value("${my.username:}")
    private String myappUsername;
    @Value("${my.password:}")
    private String myappPassword;

    @Autowired
    private RedisConfig redisConfig;

    @GetMapping("/info")
    public Map<String, Object> info() {
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("mysqlUsername", mysqlUsername);
        resultMap.put("mysqlPassword", mysqlPassword);
        resultMap.put("basicUsername", basicUsername);
        resultMap.put("basicPassword", basicPassword);
        resultMap.put("myappUsername", myappUsername);
        resultMap.put("myappPassword", myappPassword);
        resultMap.put("redisUsername", redisConfig.getUsername());
        resultMap.put("redisPassword", redisConfig.getPassword());
        return resultMap;
    }

}